# --- puzzle02 makefile
# $ID: $
#

PCCC     = gcc
PCCFLAGS = -O2 -g -Wall -DDEBUG -DNOTPSP
PCLIBS   = -L/usr/local/lib
PCINCLUDE = -I/usr/include  -I/usr/include/SDL
MACINCLUDE = -I/sw/include -I/sw/include/SDL
OBJS = input.o draw.o parser.o pspconnect.o game.o torainguru.o
PCOBJS = input.o draw.o torainguru.o

TARGET = torainguru

CFLAGS = -O2 -g -Wall -DDEBUG
LIBS=
LIBDIR =
LDFLAGS =
PSP_FW_VERSION = 371
EXTRA_TARGETS = EBOOT.PBP
EXTRA_CLEAN = pcclean

# --- PC SDL
PCCFLAGS +=$(shellsdl-config --cflags)
PCLIBS += -lSDL_image $(shell sdl-config --libs)
PCLIBS += -lSDL_mixer -lm -lSDL -lpng -lz

PSP_EBOOT_TITLE = TORAINGURU
PSP_DIR_NAME = TORAINGURU

PSPSDK= $(shell psp-config --pspsdk-path)
PSPBIN = /usr/local/pspdev/psp/bin
CFLAGS += -I/usr/local/pspdev/psp/include/SDL
LIBS += -lSDL_image -L/usr/local/pspdev/psp/lib -lSDL\
	 -lm -L/usr/local/pspdev/psp/sdk/lib -lpspdebug\
	 -lpspgu -lpspctrl -lpspge -lpspdisplay -lpsphprm -lpspsdk\
	 -lpsprtc -lpspaudio -lc -lpspuser -lpsputility -lpspkernel\
	 -lpspnet_inet
LIBS += -lSDL_mixer -lSDL -lpng -ljpeg -lz -lm
include $(PSPSDK)/lib/build.mak

pspdir :
	mkdir -p PSP/GAME371/TORAINGURU
	cp EBOOT.PBP PSP/GAME371/TORAINGURU/
	cp -R gfx PSP/GAME371/TORAINGURU


pc : pcobjs
	$(PCCC) -o $(TARGET) $(PCOBJS) $(PCLIBS)

mac : macobjs
	$(PCCC) -o $(TARGET) $(PCOBJS) $(PCLIBS)	 	

pcobjs :
	$(PCCC) $(PCCFLAGS) $(PCINCLUDE) -c torainguru.c
	$(PCCC) $(PCCFLAGS) $(PCINCLUDE) -c input.c
	$(PCCC) $(PCCFLAGS) $(PCINCLUDE) -c draw.c
macobjs :
	$(PCCC) $(PCCFLAGS) $(MACINCLUDE) -c torainguru.c
	$(PCCC) $(PCCFLAGS) $(MACINCLUDE) -c input.c
	$(PCCC) $(PCCFLAGS) $(MACINCLUDE) -c draw.c
pcclean :
	rm -rf *.o $(TARGET) $(TARGET)% $(TARGET).exe *~ PARAM.SFO EBOOT.PBP PSP/GAME371/TORAINGURU

torainguru.o : torainguru.c torainguru.h
input.o : input.c input.h
draw.o : draw.c draw.h worldObjects.h
pspconnect.o : pspconnect.c pspconnect.h
parser.o : parser.c parser.h
game.o : game.c game.h

test : torainguru
	./torainguru

